<div class="nav-header">
    <span class="htitle">
        北斗车辆监控平台
    </span>
    <ul class="menu-box" style="margin-right: 0">
        <li id="changePwd">
            <a>修改密码</a>
        </li>
        <li id="loginOut">
            <a>退出登录</a>
        </li>
    </ul>
    <ul class="menu-box" id="menu-box">

        <li resId="1" class="<%=(params["homeIsActive"]=="true" ?params["className"]: '')%>"  data-href="home" style="display: none">
            <span class="menu-img">
                <img src="images/page1/u990.png">
            </span>
            <a>大数据</a>
        </li>
        <li resId="4" class="<%=(params["dataIsActive"]=="true" ?params["className"]: '')%>"  data-href="dataManage" style="display: none">
            <span class="menu-img">
                <img src="images/page1/u972.png">
            </span>
            <a>资料管理</a>
        </li>
        <li resId="2" class="<%=(params["monitorIsActive"]=="true" ?params["className"]: '')%>"  data-href="monitor" style="display: none">
            <span class="menu-img">
                <img src="images/page1/u978.png">
            </span>
            <a>监控管理</a>
        </li>
        <li resId="7" class="<%=(params["applyIsActive"]=="true" ?params["className"]: '')%>"  data-href="application" style="display: none">
            <span class="menu-img">
                <img src="images/page1/u975.png">
            </span>
            <a>应用管理</a>
        </li>
        <li resId="6" class="<%=(params["reportIsActive"]=="true" ?params["className"]: '')%>"  data-href="reportManage" style="display: none">
            <span class="menu-img">
                <img src="images/page1/u981.png">
            </span>
            <a>数据报表</a>
        </li>
        <li resId="3" class="<%=(params["systemIsActive"]=="true" ?params["className"]: '')%>"  data-href="systemManage" style="display: none">
             <span class="menu-img">
                <img src="images/page1/u984.png">
            </span>
            <a>系统设置</a>
        </li>
    </ul>
    <script type="text/javascript" src="js/jquery/jquery.1.11.3.min.js"></script>
    <script type="text/javascript">
        var rootMenus = window.sessionStorage.getItem("rootMenus");
        if(rootMenus){
            rootMenus = JSON.parse(rootMenus);
            if(rootMenus.length){
                for(var k=0;k<rootMenus.length;k++){
                    var rootId = rootMenus[k]["id"];
                    $("#menu-box").find("li[resId='"+rootId+"']").show();
                }
                $("#menu-box").find("li:hidden").remove();
            }
        }
        $("#changePwd").click(function () {
            $("#myPwdModal").modal("show");
        });
        function closePwdModal() {
            $("#myPwdModal").modal("hide");
        }
        function changePwd() {
            var oldPwd = $("#oldPwd").val();
            var newPassWord = $("#newPassWord").val();
            var newPwd = $("#newPwd").val();
            if(oldPwd == ""){
                $.messageExt.alert("系统提示","原密码是必填项","warning");
                return false
            }
            if(newPassWord == ""){
                $.messageExt.alert("系统提示","新密码是必填项","warning");
                return false
            }
            if(newPwd == ""){
                $.messageExt.alert("系统提示","确认密码是必填项","warning");
                return false
            }
            if(newPassWord!=newPwd){
                $.messageExt.alert("系统提示","新密码与确认新密码两次输入不一致","warning");
                return false
            }
            $.post("/changePwd",{oldPwd:oldPwd,newPwd:newPwd},function (result) {
                if(result.success == true){
                    $.messageExt.alert("系统提示","修改密码成功，请重新登陆","success",function () {
                        $.link("/logout");
                    })
                }else{
                    $.messageExt.alert("系统提示",result.msg ? result.msg :"修改密码失败，请稍后重试！","error")
                }
            },"json")
        }

        
    </script>
</div>
<div class="modal inmodal" id="myPwdModal" role="dialog" data-width="500px"
     data-height="400px" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <h4 class="modal-title">修改密码</h4>
            </div>
            <div class="modal-body" style="max-height: 400px; ">

                <form class="form-horizontal m-t" method="get">
                    <div class="form-group">
                        <label class="col-sm-3 control-label label-require" style="font-size: 14px;">原密码：</label>
                        <div class="col-sm-8">
                            <input id="oldPwd" name="oldPwd" class="form-control"
                                   placeholder="原密码必填" type="password" aria-required="true"
                                   aria-invalid="true">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label label-require" style="font-size: 14px;">新密码：</label>
                        <div class="col-sm-8">
                            <input id="newPassWord" name="newPassWord" class="form-control"
                                   placeholder="新密码必填" type="password" aria-required="true"
                                   aria-invalid="true">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label label-require" style="font-size: 14px;">确认新密码：</label>
                        <div class="col-sm-8">
                            <input id="newPwd" name="newPwd" class="form-control"
                                   placeholder="确认新密码必填" type="password" aria-required="true"
                                   aria-invalid="true">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" onclick="closePwdModal()">关闭</button>
                <button type="button" class="btn btn-primary" onclick="changePwd()">保存</button>
            </div>
        </div>
    </div>
</div>

